<?php
$this->breadcrumbs=array(
	'Galleries'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Gallery', 'url'=>array('index')),
	array('label'=>'Create Gallery', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('upload', "
$('.upload-button').click(function(){
	$('.upload-form').toggle();
	return false;
});

");
?>

<h1>Manage Galleries</h1>

<?php echo CHtml::link('Upload','#',array('class'=>'upload-button')); ?>
<div class="upload-form" style="display:none">
<?php $this->renderPartial('_upload',array(
	'model'=>$model,
)); ?>
</div>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'gallery-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
	'columns'=>array(
//		array(
//                    'name'=>'id',
//                    'header'=>'No.',
//                    'value'=>'$row+1',
//                ),
                 array(
                    'name'=>'image',
                     'type'=>'html',
                     'value'=>'CHtml::link(CHtml::image("file/gallery/".$data->image, "country",
                                array("width"=>"90px", "height"=>"90px" )), "file/gallery/".$data->image, array("class"=>"highslide"))',
                    ),
		'title',
		'status',
		array(
			'class'=>'CButtonColumn',
                        'template' => '{delete} {view}',
                        'deleteButtonUrl'=>'Yii::app()->createUrl("gallery/delete", array("id" => $data->id, "filename" => $data->image ))',
                        'viewButtonUrl'=>'Yii::app()->createUrl("gallery/publish", array("id" => $data->id))',
                        'viewButtonLabel'=>'Publish/Unpublish',
		),
	),
)); ?>
